import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;

public class StudentManager {
    private Map<String, List<String>> studentsByGroup = new HashMap<>();
    private Map<String, List<String>> studentsByClass = new HashMap<>();

    public void addStudentToGroup(String groupName, String studentName) {
        studentsByGroup.computeIfAbsent(groupName, k -> new ArrayList<>()).add(studentName);
    }

    public void addStudentToClass(String className, String studentName) {
        studentsByClass.computeIfAbsent(className, k -> new ArrayList<>()).add(studentName);
    }

    public List<String> getStudentsInGroup(String groupName) {
        return studentsByGroup.getOrDefault(groupName, new ArrayList<>());
    }

    public List<String> getStudentsInClass(String className) {
        return studentsByClass.getOrDefault(className, new ArrayList<>());
    }
}